package com.gitee.wsl.time.flow

import kotlinx.coroutines.flow.Flow
import kotlinx.datetime.DayOfWeek
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.Month

@Suppress("NOTHING_TO_INLINE")
inline fun Flow<LocalDateTime>.onlyStartsOfMinutes() = filterSeconds(0)

@Suppress("NOTHING_TO_INLINE")
inline fun Flow<LocalDateTime>.onlyStartsOfHours() = filterMinutes(0).onlyStartsOfMinutes()

@Suppress("NOTHING_TO_INLINE")
inline fun Flow<LocalDateTime>.onlyStartsOfDays() = filterHours(0).onlyStartsOfHours()

@Suppress("NOTHING_TO_INLINE")
inline fun Flow<LocalDateTime>.onlyStartsOfMondays() = filterWeekDays(DayOfWeek.MONDAY).onlyStartsOfDays()

@Suppress("NOTHING_TO_INLINE")
inline fun Flow<LocalDateTime>.onlyStartsOfSundays() = filterWeekDays(DayOfWeek.SUNDAY).onlyStartsOfDays()

@Suppress("NOTHING_TO_INLINE")
inline fun Flow<LocalDateTime>.onlyStartsOfMonths() = filterDaysOfMonths(1).onlyStartsOfDays()

@Suppress("NOTHING_TO_INLINE")
inline fun Flow<LocalDateTime>.onlyStartsOfYears() = filterMonths(Month.JANUARY).onlyStartsOfMonths()